package com.erp.erp_servers.warehouse.imp;

import com.erp.erp_dao.warehouse.IInventoryDao;
import com.erp.erp_entitys.warehouse.entity.InventoryEntity;
import com.erp.erp_entitys.warehouse.req.InventoryListReq;
import com.erp.erp_servers.warehouse.IInventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName : InventoryServiceImp
 * @Description : 盘点实现类
 * @Author : lst
 * @Date: 2020-07-24 14:47
 */
@Service
public class InventoryServiceImp implements IInventoryService {

    /**
     * 盘点接口
     */
    private final IInventoryDao inventoryDao;

    @Autowired
    public InventoryServiceImp(IInventoryDao inventoryDao) {
        this.inventoryDao = inventoryDao;
    }

    /**
     * 通过实体作为筛选条件查询
     * @param inventory 实例对象
     * @return 对象列表
     */
    @Override
    public List<InventoryEntity> queryAll(InventoryEntity inventory) {
        return inventoryDao.queryAll(inventory);
    }

    /**
     * 获取盘点信息
     * @param req 查询参数实体
     * @return 盘点信息
     */
    @Override
    public List<InventoryEntity> getInventoryInfo(InventoryListReq req) {
        return inventoryDao.getInventoryInfo(req);
    }

    /**
     * 新增数据
     * @param inventory 实例对象
     * @return 影响行数
     */
    @Override
    public int insert(InventoryEntity inventory) {
        return inventoryDao.insert(inventory);
    }


    /**
     * 通过主键修改数据
     * @param inventory 盘点对象
     * @return 影响行数
     */
    @Override
    public int update(InventoryEntity inventory) {
        return inventoryDao.update(inventory);
    }

    /**
     * 通过id获取盘点
     * @param id id
     * @return 盘点对象
     */
    @Override
    public InventoryEntity getInventoryById(Integer id) {
        return inventoryDao.getInventoryById(id);
    }
}
